﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Baopx_API;

namespace A.Controller
{
    public class ProductCategoryController
    {
        public static void Insert(ProductCategory productCategory)
        {
            A.M.d.ProductCategories.InsertOnSubmit(productCategory);
            A.M.d.SubmitChanges();
        }

        public static void Update()
        {
            A.M.d.SubmitChanges();
        }

        public static void Delete(ProductCategory productCategory)
        {
            A.M.d.ProductCategories.DeleteOnSubmit(productCategory);
            A.M.d.SubmitChanges();
        }

        public static ProductCategory GetElementById(int id)
        {
            return A.M.d.ProductCategories.SingleOrDefault(i => i.Id == id);
        }

        public static List<ProductCategory> GetAll()
        {
            return A.M.d.ProductCategories.ToList();
        }
    }
}
